#ifndef _IIC_FUNCTION_H_
#define _IIC_FUNCTION_H_
#include <stdio.h> 
#include "aos/hal/i2c.h"
#include "camera_config.h"
#include "sensor_common.h"
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(arr)     ( sizeof(arr) / sizeof((arr)[0]) )
#endif 

int32_t iic_write(i2c_dev_t *i2c, uint16_t reg, uint8_t val);
int32_t iic_write_r8_d8(i2c_dev_t *i2c, uint8_t reg, uint8_t val);
int32_t iic_write16bit(i2c_dev_t *i2c, uint16_t reg, uint16_t val);
int32_t iic_write_r16_d16(i2c_dev_t *i2c, uint16_t reg, uint16_t val);
int32_t iic_read(i2c_dev_t *i2c, uint16_t reg, uint8_t *read_data);
int32_t iic_read_r8_d8(i2c_dev_t *i2c, uint8_t reg, uint8_t *read_data);
int32_t iic_read16bit(i2c_dev_t *i2c, uint16_t reg, uint8_t *read_data);
int32_t iic_read_r16_d16(i2c_dev_t *i2c, uint16_t reg, uint8_t *read_data);
int32_t iic_write_array(i2c_dev_t *i2c,  regval_list *regs, uint32_t array_size);
int32_t iic_write16bit_array(i2c_dev_t *i2c,  regval_list *regs, uint32_t array_size);
int32_t iic_write_array_r8_d8(i2c_dev_t *i2c, regval_list *regs, uint32_t array_size);
int32_t iic_read_array(i2c_dev_t *i2c,  regval_list *regs, uint32_t array_size);
int32_t iic_read16bit_array(i2c_dev_t *i2c,  regval_list *regs, uint32_t array_size);
int32_t iic_read_array_r8_d8(i2c_dev_t *i2c, regval_list *regs, uint32_t array_size);

int isp_i2c_init(int num, i2c_dev_t *i2c,uint32_t dev_addr);
int I2C_read(uint8_t bus_num, uint16_t slave_addr, uint16_t reg_addr, 
                    uint8_t reg_addr_size, uint8_t *data_buf, uint32_t byte_size);
int I2C_write(uint8_t bus_num, uint16_t slave_addr, uint16_t reg_addr, 
                uint8_t reg_addr_size, uint8_t *reg_data, uint32_t byte_size);
#endif

